<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JavaScript计算圆的周长和面积</title>
</head>
<body>

<span>圆的半径：</span><input type="text" placeholder="半径" id="a"> <p></p>
<span>圆的周长：</span><input type="text" placeholder="周长" id="b"> <p></p>
<span>圆的面积：</span><input type="text" placeholder="面积" id="c"> <p></p>


<script>
    /*半径*/
    var Lone = prompt("请输入圆的半径");
    document.querySelector("#a").value = Lone;
    /*半径和π 的取值*/
    var r = Lone;
    var w = 3.14;

    /*圆的周长 2πr*/
    var C =(r * 2) * w;
    document.querySelector("#b").value = C;


    /*圆的面积 πr平方*/
    var S =(r * r) * w;
    document.querySelector("#c").value = S;

</script>
</body>
</html>